<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="utf-8">
		<title>用户中心</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="/resource/layui/css/layui.css">
		<link rel="stylesheet" href="/resource/css/global.css">
		<link rel="stylesheet" href="/resource/css/common.css">
	</head>
	<body>

		<div class="fly-header layui-bg-green">
			<div class="layui-container">
				<a class="fly-logo" href="/user/redirectIndex.do">
					<div class="layui-logo" style="font-size: 20px; color: #CAE1FF;"><span class="iconfont-ali icon-B" style="font-size: 35px"></span></div>
				</a>
			    <ul class="layui-nav fly-nav layui-hide-xs">
			      <li class="layui-nav-item layui-this">
			        <a href="/user/redirectIndex.do"><i class="layui-icon  layui-icon-home"></i>首页</a>
			      </li>
    			</ul>
				<ul class="layui-nav fly-nav-user">
					<!-- 登入后的状态 -->
					<li class="layui-nav-item">
						<a class="fly-nav-avatar" href="">
							<cite class="layui-hide-xs">${user.userName }</cite>
				    		<img <c:if test="${!empty user.headSculpture }">src="${user.headSculpture }"</c:if><c:if test="${empty user.headSculpture }">src="/resource/img/logo.JPG"</c:if> alt="${user.userName}">
						</a>
						<dl class="layui-nav-child layui-bg-green">
				    	    <dd><a href="/user/userindex.do"><i class="layui-icon">&#xe609;</i>用户中心</a></dd>
							<dd><a href="/user/userset.do"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
							<dd><a href="/user/usermessage.do"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a></dd>
							<dd><a href="/user/userhome.do"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
							<hr style="margin: 5px 0;">
							<dd><a href="/user/logout.do" ><i class="iconfont-ali icon-tuichu"></i>退出</a></dd>
						</dl>
					</li>
				</ul>
			</div>
		</div>

		<div class="layui-container fly-marginTop fly-user-main">
			<ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
				<li class="layui-nav-item">
					<a href="/user/userhome.do">
						<i class="layui-icon">&#xe609;</i>
						我的主页
					</a>
				</li>
				<li class="layui-nav-item layui-this">
					<a href="/user/userindex.do">
						<i class="layui-icon">&#xe612;</i>
						用户中心
					</a>
				</li>
				<li class="layui-nav-item">
					<a href="/user/userset.do">
						<i class="layui-icon">&#xe620;</i>
						基本设置
					</a>
				</li>
				<li class="layui-nav-item">
					<a href="/user/usermessage.do">
						<i class="layui-icon">&#xe611;</i>
						我的消息
					</a>
				</li>
			</ul>

			<div class="site-tree-mobile layui-hide">
				<i class="layui-icon">&#xe602;</i>
			</div>
			<div class="site-mobile-shade"></div>

			<div class="site-tree-mobile layui-hide">
				<i class="layui-icon">&#xe602;</i>
			</div>
			<div class="site-mobile-shade"></div>
			<div class="fly-panel fly-panel-user" pad20>
				<div class="layui-tab layui-tab-brief" lay-filter="user">
					<ul class="layui-tab-title" id="LAY_mine">
						<li data-type="publish" lay-id="index" <c:if test="${whichPage=='publish'}">class="layui-this"</c:if> >我的发表（<span>${essaylistsize }</span>）</li>
						<li data-type="collection"  lay-id="collection" <c:if test="${whichPage=='collection'}">class="layui-this"</c:if> >我的收藏（<span>${collectionEssayListSize }</span>）</li>
						<li data-type="attention"  lay-id="attention" <c:if test="${whichPage=='attention'}">class="layui-this"</c:if> >我的关注（<span>${attentionUserListSize }</span>）</li>
						<li data-type="download"  lay-id="download" <c:if test="${whichPage=='download'}">class="layui-this"</c:if> >我的下载（<span>${obtainEssayListSize }</span>）</li>
					</ul>
					<div class="layui-tab-content" style="padding: 20px 0;">
						<div class="layui-tab-item layui-show">
							<ul class="mine-view jie-row">
							<c:if test="${!empty essaylist }">
							<!-- 我发表的帖子的循环开始 -->
							<c:forEach items="${essaylist }" var="essay">
								<li>
									<a class="jie-title" href="/essay/essaydetail.do?essayId=${essay.essayId }" >${essay.title }</a>
									<i>${essay.publishDate }</i>
									<span id="essaydelete" class="mine-delete" essayId=${essay.essayId }>删除</span>
									<em>${essay.likeNumber }赞/${essay.treadNumber }踩</em>
								</li>
							</c:forEach> 
								<!-- 我发表的帖子的循环结束 -->
							</c:if>
							<c:if test="${empty essaylist }">
								<div class="fly-none">没有相关数据</div>
							</c:if>
							</ul>
							<div style="text-align: center">
							<div id="Bpage"></div>
							</div>
							<input type="text" class="layui-hide" id="FcurrentPage" value="">
						</div>
						<div class="layui-tab-item">
							<ul class="mine-view jie-row">
							<c:if test="${!empty collectionEssayList }">
							<!-- 我收藏的帖子的循环开始 -->
							<c:forEach items="${collectionEssayList }" var="collectionEssayList">
								<li>
									<a class="jie-title" href="/essay/essaydetail.do?essayId=${collectionEssayList.essayId }" >${collectionEssayList.title }</a>
									<button id="uncollection" class="layui-btn layui-btn-xs mine-uncollection" essayId=${collectionEssayList.essayId }>取消收藏</button>
								 </li>
								 </c:forEach>
							 <!-- 我收藏的帖子的循环结束 -->
							 </c:if>
							 <c:if test="${empty collectionEssayList }">
								<div class="fly-none">没有相关数据</div>
							</c:if>
							</ul>
							<div style="text-align: center">
							<div id="Bpage1"></div>
							</div>
						</div>
						<div class="layui-tab-item">
							<ul class="mine-view jie-row">
							<c:if test="${!empty attentionUserList }">
							<!-- 我关注的人的循环开始 -->
							<c:forEach items="${attentionUserList}" var="attentionUserList">
								<li>
									<a class="jie-title" href="/user/otheruserhome.do?userName=${attentionUserList.userName }" target="_blank">${attentionUserList.userName }</a>
									<span id="uncollection" class="mine-unattention" userId=${attentionUserList.userId }>取消关注</span>
								 </li>
							 </c:forEach>
							 <!-- 我关注的人的循环结束 -->
							 </c:if>
							 <c:if test="${empty attentionUserList }">
								<div class="fly-none">没有相关数据</div>
							</c:if>
							</ul>
							<div style="text-align: center">
							<div id="Bpage2"></div>
							</div>
						</div>
						<div class="layui-tab-item">
							<ul class="mine-view jie-row">
							<c:if test="${!empty obtainEssayList }">
							<!-- 我收藏的帖子的循环开始 -->
							<c:forEach items="${obtainEssayList }" var="obtainEssayList">
								<li>
									<a class="jie-title" href="/essay/essaydetail.do?essayId=${obtainEssayList.essayId }" >${obtainEssayList.title }</a>
								 </li>
								 </c:forEach>
							 <!-- 我收藏的帖子的循环结束 -->
							 </c:if>
							 <c:if test="${empty obtainEssayList }">
								<div class="fly-none">没有相关数据</div>
							</c:if>
							</ul>
							<div style="text-align: center">
							<div id="Bpage3"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<input type="text" class="layui-hide" id="PublishNumber" value="${essaylistsize}">
		<input type="text" class="layui-hide" id="CollectionNumber" value="${collectionEssayListSize}">
		<input type="text" class="layui-hide" id="AttentionNumber" value="${attentionUserListSize}">
		<input type="text" class="layui-hide" id="ObtainNumber" value="${obtainEssayListSize}">
		<input type="text" class="layui-hide" id="whichPage" value="${whichPage}">
		<input type="text" class="layui-hide" id="PcurrentPage" value="${PcurrentPage}">
		<input type="text" class="layui-hide" id="CcurrentPage" value="${CcurrentPage}">
		<input type="text" class="layui-hide" id="AcurrentPage" value="${AcurrentPage}">
		<input type="text" class="layui-hide" id="OcurrentPage" value="${OcurrentPage}">

		<div class="fly-footer">
				<p>Believe 社区 2019 &copy; 千夜 出品</p>
		</div>
		<script src="/resource/js/jquery.min.js"></script>
		<script type="text/javascript" src="/resource/js/common.js"></script>	
		<script src="/resource/layui/layui.js"></script>
		<script src="/resource/js/userindex.js"></script>
		<script>
			//注意：导航 依赖 element 模块，否则无法进行功能性操作
			layui.use('element', function() {
				var element = layui.element;
			});
			//检测session是否过期  或者未登录
			layui.use('layer',function(){
				$(document).ready(function(){
					var se="${user}";
					if(se==""){
					layer.alert('登录过期或未登录，请登录', function(index){
						  window.location.href="/login.html";
						  layer.close(index);
						}); 
					}
				});
			});
		</script>
	</body>
</html>
